package com.lucky.demo.listener;

import cn.idev.excel.context.AnalysisContext;
import cn.idev.excel.event.AnalysisEventListener;

import java.util.ArrayList;
import java.util.List;

public class ExcelListenner<T> extends AnalysisEventListener<T> {

    List<T> dataList = new ArrayList<>();

    @Override
    public void invoke(T record, AnalysisContext context) {
        System.out.println("解析一条学生信息 ");
        dataList.add(record);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext context) {
        System.out.println("数据读取完成，共读取了 " + dataList.size() + " 条员工记录");
    }

    public List<T> getDataList() {
        return dataList;
    }
}
